using System;
using System.Windows;

namespace Columbus
{
    public class NavigationContext
    {
        public INavigator Navigator { get; private set; }
        public IApplicationSettings ApplicationSettings { get; private set; }
        public Func<string, FrameworkElement> ViewLocator { get; private set; }
        public NavigationRequest Request { get; internal set; }
        public bool NeedToSaveRequestInJournal { get; set; }
        public bool CancelRequested { get; private set; }

        public NavigationContext(
            INavigator navigator, 
            IApplicationSettings settings,
            Func<string, FrameworkElement> viewLocator, 
            NavigationRequest request = null)
        {
            if (navigator == null) throw new ArgumentNullException("navigator");
            if (viewLocator == null) throw new ArgumentNullException("viewLocator");

            Navigator = navigator;
            ApplicationSettings = settings;
            ViewLocator = viewLocator;
            Request = request;
        }

        public void CancelAction()
        {
            CancelRequested = true;
        }
    }
}